package com.qkm.xinguan.controller;

import com.qkm.xinguan.domain.transform.dto.*;
import com.qkm.xinguan.domain.transform.form.TouristSearchForm;
import com.qkm.xinguan.domain.transform.form.UserSearchForm;
import com.qkm.xinguan.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author zfj
 * @date 2021/12/20 -16:26
 * 游客
 */
@RequestMapping("/system/tourist")
@Api(value = "游客管理模块", tags = "游客管理接口")
public interface ITouristController {

	@GetMapping("/list")
	@PreAuthorize("hasAuthority('tourist:query')")
	@ApiOperation(value = "分页获取用户列表信息", notes = "分页")
	Result getTouristListPage(@RequestParam(value = "page", defaultValue = "1") Integer page,
	                        @RequestParam(value = "size", defaultValue = "5") Integer size);

	@PostMapping("/search")
	@PreAuthorize("hasAuthority('tourist:query')")
	@ApiOperation(value = "查询用户列表信息", notes = "分页查询")
	Result searchTouristListPage(@RequestBody TouristSearchForm touristSearchForm, @RequestParam(value = "page", defaultValue = "1") Integer page,
	                             @RequestParam(value = "size", defaultValue = "5") Integer size);

	@PutMapping("/forbidden")
	@PreAuthorize("hasAuthority('tourist:status')")
	@ApiOperation(value = "修改租户状态信息", notes = "修改租户状态")
	Result updateTouristStatus(@RequestParam("id") Long id, @RequestParam("forbidden") Boolean forbidden);

	@PostMapping("/add")
	@ApiOperation(value = "注册游客", notes = "游客注册")
	Result addTourist(@RequestBody @Validated TouristDTO touristDTO, BindingResult result);

	@PostMapping("/edit/{id}")
	@ApiOperation(value = "编辑游客", notes = "游客")
	Result editTourist(@RequestBody @Validated UpdateTouristDTO updateTouristDTO, @PathVariable("id") Long id, BindingResult result);

	@PostMapping("/login")
	@ApiOperation(value = "用户登录接口", notes = "登录")
	Result login(@RequestBody @Validated TouristLoginDTO loginDTO, BindingResult result);

	@GetMapping("/pdf")
	@ApiOperation(value = "专用pdf", notes = "pdf打印")
    void pdf(HttpServletResponse response);

}
